<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('用户信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>手机号：</label>
                                <input type="text" name="phone"/>
                            </li>
                            <li>
                                <label>账号：</label>
                                <input type="text" name="account"/>
                            </li>
                            <li>
                                <label>密码：</label>
                                <input type="text" name="password"/>
                            </li>
                            <li>
                                <label>资金密码：</label>
                                <input type="text" name="capitalPwd"/>
                            </li>
                            <li>
                                <label>抽成(上级抽走比例)：</label>
                                <input type="text" name="share"/>
                            </li>
                            <li>
                                <label>用户状态：</label>
                                <select name="status" th:with="type=${@dict.getType('enableStatus')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>来源：</label>
                                <select name="source" th:with="type=${@dict.getType('dataSource')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>上级id：</label>
                                <input type="text" name="pid"/>
                            </li>
                            <li>
                                <label>邀请码：</label>
                                <input type="text" name="code"/>
                            </li>
                            <li>
                                <label>头像：</label>
                                <input type="text" name="avatar"/>
                            </li>
                            <li>
                                <label>用户昵称：</label>
                                <input type="text" name="nickName"/>
                            </li>
                            <li>
                                <label>用户真实姓名：</label>
                                <input type="text" name="realName"/>
                            </li>
                            <li>
                                <label>用户性别：</label>
                                <select name="gender" th:with="type=${@dict.getType('sys_user_sex')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>用户类型：</label>
                                <select name="type" th:with="type=${@dict.getType('userType')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>用户级别：</label>
                                <input type="text" name="level"/>
                            </li>
                            <li>
                                <label>出生日期：</label>
                                <input type="text" name="birthDay"/>
                            </li>
                            <li>
                                <label>用户微信：</label>
                                <input type="text" name="userWeixin"/>
                            </li>
                            <li>
                                <label>用户qq：</label>
                                <input type="text" name="userQq"/>
                            </li>
                            <li>
                                <label>邮箱：</label>
                                <input type="text" name="email"/>
                            </li>
                            <li>
                                <label>余额：</label>
                                <input type="text" name="balance"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="biz:user:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="biz:user:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="biz:user:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="biz:user:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
     <th:block th:include="include :: bootstrap-table-fixed-columns-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('biz:user:edit')}]];
        var removeFlag = [[${@permission.hasPermi('biz:user:remove')}]];
        var statusDatas = [[${@dict.getType('enableStatus')}]];
        var sourceDatas = [[${@dict.getType('dataSource')}]];
        var genderDatas = [[${@dict.getType('sys_user_sex')}]];
        var typeDatas = [[${@dict.getType('userType')}]];
        var prefix = ctx + "biz/user";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                fixedColumns: true,
                fixedRightNumber: 1,
                sortName: "user_id",
                sortOrder: "desc",
                modalName: "用户信息",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '主键ID',
                    visible: false
                },
                {
                    field: 'phone',
                    title: '手机号'
                },
                {
                    field: 'account',
                    title: '账号'
                },
                {
                    field: 'password',
                    title: '密码'
                },
                {
                    field: 'capitalPwd',
                    title: '资金密码'
                },
                {
                    field: 'share',
                    title: '抽成(上级抽走比例)'
                },
                {
                    field: 'status',
                    title: '用户状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(statusDatas, value);
                    }
                },
                {
                    field: 'source',
                    title: '来源',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(sourceDatas, value);
                    }
                },
                {
                    field: 'pid',
                    title: '上级id'
                },
                {
                    field: 'code',
                    title: '邀请码'
                },
                {
                    field: 'avatar',
                    title: '头像'
                },
                {
                    field: 'nickName',
                    title: '用户昵称'
                },
                {
                    field: 'realName',
                    title: '用户真实姓名'
                },
                {
                    field: 'gender',
                    title: '用户性别',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(genderDatas, value);
                    }
                },
                {
                    field: 'type',
                    title: '用户类型',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(typeDatas, value);
                    }
                },
                {
                    field: 'level',
                    title: '用户级别'
                },
                {
                    field: 'birthDay',
                    title: '出生日期'
                },
                {
                    field: 'userWeixin',
                    title: '用户微信'
                },
                {
                    field: 'userQq',
                    title: '用户qq'
                },
                {
                    field: 'email',
                    title: '邮箱'
                },
                {
                    field: 'balance',
                    title: '余额'
                },
                {
                    field: 'hobby',
                    title: '爱好'
                },
                {
                    field: 'remark',
                    title: '备注'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i> 编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i> 删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>